package com.webapp.common;

import lombok.extern.slf4j.Slf4j;

import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;


/**
 * @Author: Jimmy Li
 * @E-mail: jimmy.c.li@cn.pwc.com
 * @Date: 24/03/2020
 * @Description:
 */
@Slf4j
public class FilesOperation {
    
    public static String runPython(String pyUrl, String str) {
    	String cmd = "/home/dcos/python3.6/bin/python3 " + pyUrl + " " + str;
//    	String cmd = "python " + pyUrl + " " + str;
        ArrayList<String> lines = new ArrayList();
        try {
        	Process proc = Runtime.getRuntime().exec(cmd);
            BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
            String line = null;
            while ((line = in.readLine()) != null) {
                lines.add(line+"/");
            }
            in.close();
            proc.waitFor();
            log.info("Python script execultion is finish!");
            String result = "";
            for (String string : lines) {
            	result+=string;
			}
            return result;
        } catch (IOException e) {
            log.info("Python script execultion is error!");
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
            log.info("Python script execultion is error!");
        }
        return null;
    }

    /**
     * 读取Json文件
     * @param jsonfileurl
     * @return
     */
    public static String readJsonFile(String jsonfileurl) {
        String jsonStr = "";
        try {
            File jsonFile = new File(jsonfileurl);
            FileReader fileReader = new FileReader(jsonFile);
            Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8");
            int ch = 0;
            StringBuffer sb = new StringBuffer();
            while ((ch = reader.read()) != -1) {
                sb.append((char) ch);
            }
            fileReader.close();
            reader.close();
            jsonStr = sb.toString();
            return jsonStr;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
    
    public static void main(String[] args) {
		String ss = "{'Q10':10,'Q1':52,'Q3':'上海-上海','Q5_1':1,'Q5_2':1,'Q5_3':2,'Q5_7':1,'Q5_8':1,'Q5_9':0,'Q6_1':50,'Q6_2':20,'Q6_3':20,'Q6_7':10,'Q6_8':0,'Q6_9':0,'Q8':2,'Q16_1':0,'Q16_2':0,'Q16_3':1,'Q16_4':0,'Q16_5':1,'Q17':2,'Q21_1':1,'Q21_2':0,'Q21_3':0,'Q21_4':1,'Q21_5':0,'Q21_6':1,'Q21_7':0,'Q23_1':1,'Q23_2':1,'Q23_3':1,'Q23_7':1,'Q23_8':2,'Q23_9':0,'Q26':5,'Q29':3,'Q32_1':26,'Q32_2':15,'Q32_3':-2,'Q33_1':0,'Q33_2':10,'Q33_3':-2,'Q34_1':3,'Q34_2':3,'Q34_3':0,'Q49_1':1,'Q49_2':2,'Q49_3':3,'Q49_4':4,'Q49_5':5,'Q49_6':6} {'city_lev':['一级城市','一级城市','一级城市','一级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','三级城市','二级城市','二级城市','二级城市','二级城市','二级城市','二级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','三级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市','四级城市'],'city':['上海','北京','深圳','广州','重庆','天津','苏州','重庆','成都','武汉','杭州','南京','青岛','长沙','无锡','宁波','佛山','郑州','济南','泉州','南通','西安','东莞','烟台','福州','大连','合肥','唐山','长春','常州','哈尔滨','石家庄','潍坊','徐州','沈阳','温州','郴州','呼和浩特','新乡','兰州','周口','九江','湖州','宿迁','连云港','株洲','滨州','大庆','赣州','许昌','江门','珠海','吉林','湛江','柳州','遵义','茂名','南阳','乌鲁木齐','廊坊','菏泽','芜湖','衡阳','聊城','德州','保定','常德','岳阳','淮安','包头','泰安','中山','鄂尔多斯','贵阳','邯郸','榆林','太原','漳州','沧州','威海','镇江','宜昌','金华','惠州','襄阳','南宁','东营','洛阳','临沂','厦门','嘉兴','台州','济宁','泰州','南昌','淄博','昆明','绍兴','扬州','盐城','宿州','淮北','阜阳','蚌埠','淮南','滁州','马鞍山','铜陵','安庆','黄山','六安','池州','宣城','亳州','界首','明光','天长','桐城','宁国','巢湖','南平','三明','莆田','龙岩','宁德','福清','长乐','邵武','武夷山','建瓯','建阳','永安','石狮','晋江','南安','龙海','漳平','福安','福鼎','嘉峪关','金昌','白银','天水','酒泉','张掖','武威','庆阳','平凉','定西','陇南','玉门','敦煌','临夏','合作','清远','韶关','河源','梅州','潮州','汕头','揭阳','汕尾','肇庆','云浮','阳江','从化','增城','英德','连州','乐昌','南雄','兴宁','普宁','陆丰','恩平','台山','开平','鹤山','高要','四会','罗定','阳春','化州','信宜','高州','吴川','廉江','雷州','六盘水','安顺','毕节','铜仁','清镇','赤水','仁怀','凯里','都匀','兴义','福泉','秦皇岛','邢台','张家口','承德','衡水','辛集','藁城','晋州','新乐','鹿泉','遵化','迁安','霸州','三河','定州','涿州','安国','高碑店','泊头','任丘','黄骅','河间','冀州','深州','南宫','沙河','武安','齐齐哈尔','黑河','伊春','鹤岗','佳木斯','双鸭山','七台河','鸡西','牡丹江','绥化','双城','尚志','五常','阿城','讷河','北安','五大连池','铁力','同江','富锦','虎林','密山','绥芬河','海林','宁安','安达','肇东','海伦','开封','平顶山','安阳','鹤壁','焦作','濮阳','漯河','三门峡','商丘','驻马店','信阳','济源','巩义','邓州','永城','汝州','荥阳','新郑','登封','新密','偃师','孟州','沁阳','卫辉','辉县','林州','禹州','长葛','舞钢','义马','灵宝','项城','十堰','襄樊','荆门','孝感','黄冈','鄂州','黄石','咸宁','荆州','随州','仙桃','天门','潜江','丹江口','老河口','枣阳','宜城','钟祥','汉川','应城','安陆','广水','麻城','武穴','大冶','赤壁','石首','洪湖','松滋','宜都','枝江','当阳','恩施','利川','张家界','益阳','湘潭','永州','邵阳','怀化','娄底','耒阳','常宁','浏阳','津市','沅江','汨罗','临湘','醴陵','湘乡','韶山','资兴','武冈','洪江','冷水江','涟源','吉首','白城','松原','四平','辽源','通化','白山','德惠','九台','榆树','磐石','蛟河','桦甸','舒兰','洮南','大安','双辽','公主岭','梅河口','集安','临江','延吉','图们','敦化','珲春','龙井','和龙','景德镇','鹰潭','新余','萍乡','上饶','抚州','宜春','吉安','瑞昌','乐平','瑞金','南康','德兴','丰城','樟树','高安','井冈山','贵溪','江阴','宜兴','邳州','新沂','金坛','溧阳','常熟','张家港','太仓','昆山','吴江','如皋','海门','启东','大丰','东台','高邮','仪征','扬中','句容','丹阳','兴化','姜堰','泰兴','靖江','朝阳','阜新','铁岭','抚顺','本溪','辽阳','鞍山','丹东','营口','盘锦','锦州','葫芦岛','新民','瓦房店','普兰店','庄河','北票','凌源','调兵山','开原','灯塔','海城','凤城','东港','大石桥','盖州','凌海','北宁','兴城','日照','枣庄','莱芜','章丘','胶州','胶南','即墨','平度','莱西','临清','乐陵','禹城','安丘','昌邑','高密','青州','诸城','寿光','栖霞','海阳','龙口','莱阳','莱州','蓬莱','招远','文登','荣成','乳山','滕州','曲阜','兖州','邹城','新泰','肥城','延安','铜川','渭南','咸阳','宝鸡','汉中','商洛','安康','韩城','华阴','兴平','大同','朔州','阳泉','长治','晋城','忻州','吕梁','晋中','临汾','运城','古交','潞城','高平','原平','孝义','汾阳','介休','侯马','霍州','永济','河津','广元','绵阳','德阳','南充','广安','遂宁','内江','乐山','自贡','泸州','宜宾','攀枝花','巴中','达州','资阳','眉山','雅安','崇州','邛崃','都江堰','彭州','江油','什邡','广汉','绵竹','阆中','华蓥','峨眉山','万源','简阳','西昌','曲靖','玉溪','丽江','昭通','思茅','临沧','保山','安宁','宣威','芒市','瑞丽','大理','楚雄','个旧','开远','景洪','舟山','衢州','丽水','临安','富阳','建德','慈溪','余姚','奉化','平湖','海宁','桐乡','诸暨','上虞','嵊州','江山','兰溪','永康','义乌','东阳','临海','温岭','瑞安','乐清','龙泉','西宁','格尔木','德令哈','海口市','三亚市','文昌市','琼海市','万宁市','东方市','儋州市','五指山市','桂林','梧州','贵港','玉林','钦州','北海','防城港','崇左','百色','河池','来宾','贺州','岑溪','桂平','北流','东兴','凭祥','宜州','合山','乌海','赤峰','呼伦贝尔','通辽','乌兰察布','巴彦淖尔','满洲里','扎兰屯','牙克石','根河','额尔古纳','乌兰浩特','阿尔山','霍林郭勒','锡林浩特','二连浩特','丰镇','银川','石嘴山','吴忠','中卫','固原','灵武','青铜峡','拉萨','日喀则','克拉玛依','石河子','阿拉尔','图木舒克','五家渠','北屯','喀什','阿克苏','和田','吐鲁番','哈密','阿图什','博乐','昌吉','阜康','米泉','库尔勒','伊宁','奎屯','塔城','乌苏','阿勒泰'],'avg_house':[51717,42352,42352,42352,14715,14715,14715,14715,13550,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,14715,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,8553,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522,6522],'per_avg_ann_exp':[48272,39340,40535,40637,32193,29416,33327,32193,27312,41615,33537,32890,32165,31605,31605,31605,26256,31605,31605,31605,31605,31605,31605,31605,31605,31605,31605,31605,31605,27348,28625,31605,31605,31605,31605,31605,31605,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,27040,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101,19101],'per_avg_ann_inc':[73615,111337,86970,88299,65743,70757,70757,70757,45878,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,70757,40007,70757,70757,70757,70757,70757,70757,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,59384,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314,42314]} {'city_lev':['一级城市','二级城市','三级城市','四级城市','五级城市'],'daily_cosp_index_city':[1.8,1.5,1.42,0.8,0.75],'extra_edu_spd_index_city':[1.8,1.5,1.42,0.8,0.75]} {'extra_edu_spd_index_inc':[0.89,1.0,1.2,1.34,1.5,2.0],'daily_cosp_index_inc':[0.89,1.0,1.2,1.34,1.5,2.0],'inc_lev':[1,2,3,4,5,6]} 0.03 {'fam_consp_index':[0.73,0.73,0.73,0.75,0.75,0.75],'acc_index':[1.2,1.25,1.276,1.239,1.026,1.002],'acc_med_exp_index':[0.5,0.8,1.2,1.8,1.8,4.0],'chi_mar_index':[0.5,0.64,0.64,0.75,1.5,1.75],'inc_lev':[1,2,3,4,5,6]} {'med_cost_index_ci':[0.83,0.83,0.83,0.66,0.66],'city_lev':['一级城市','二级城市','三级城市','四级城市','五级城市'],'care_consp_index_ci':[1.0,1.0,0.8,0.6,0.6]} {'tre_spd_index_ci':[1.0,0.8,0.47,0.42,0.37,0.36],'nur_spd_index_ci':[6.0,5.0,2.0,1.0,0.8,0.7],'per_inc_lev1':[6,5,4,3,2,1],'inc_index_ci':[0.01,0.01,0.01,0.01,0.05,0.05],'inc_comp_ci':[0.1659,0.23631,0.35609,0.40743,0.63609,0.66609],'nur_liv_pct':[0.4,0.4,0.37,0.35,0.26,0.2]} {'med_cost_index_med':[1.2,1.187,1.082,0.66,0.6],'city_lev':['一级城市','二级城市','三级城市','四级城市','五级城市']} {'lux_med_index':[0.8,1.26,1.382,2.152,2.552,1.25],'per_inc_lev1':[1,2,3,4,5,6],'tre_spd_index_med':[0.853,1.01,1.034,1.1835,1.2,1.37]} {'inc_raise':[1.05,1.05,1.12,1.15,1.23,1.45],'per_inc_lev2':[1,2,3,4,5,6],'inc_rep':[0.33,0.35,0.42,0.55,0.58,0.65]} {'age_stage2':[1,2,3],'inc_coef':[1.065,1.034,0.96]} {'inc_rep_coef':[1.050555292,1.024104803,1.0,0.98,0.95],'city_lev':['一级城市','二级城市','三级城市','四级城市','五级城市']}";
		String file = "C:\\Users\\gyj\\Desktop\\model\\src\\main\\resources\\py\\保额公式_0917.py";
		String runPython = runPython(file, ss);
		System.out.println(runPython);
		runPython = runPython.substring(0,runPython.length()-1);
		String[] split = runPython.split("/");
		Map<String, Object> map = new HashMap<String, Object>();
		boolean Own = true;
		boolean Couple = true;
		boolean Parents = true;
		boolean FirstChild = true;
		boolean SecondChild = true;
		boolean ThirdChild = true;
		for (String string : split) {
			Map<String, Object> jsonMap = JSONObject.parseObject(string, Map.class);
			if(jsonMap.get("Own")!=null){
				if(!jsonMap.get("Own").equals("None")){
					map.put("Own", jsonMap.get("Own"));
				}else{
					Own = false;
				}
			}
			if(jsonMap.get("Couple")!=null){
				if(!jsonMap.get("Couple").equals("None")){
					map.put("Couple", jsonMap.get("Couple"));
				}else{
					Couple = false;
				}
			}
			if(jsonMap.get("Parents")!=null){
				if(!jsonMap.get("Parents").equals("None")){
					map.put("Parents", jsonMap.get("Parents"));
				}else{
					Parents = false;
				}
			}
			if(jsonMap.get("FirstChild")!=null){
				if(!jsonMap.get("FirstChild").equals("None")){
					map.put("FirstChild", jsonMap.get("FirstChild"));
				}else{
					FirstChild = false;
				}
			}
			if(jsonMap.get("SecondChild")!=null){
				if(!jsonMap.get("SecondChild").equals("None")){
					map.put("SecondChild", jsonMap.get("SecondChild"));
				}else{
					SecondChild = false;
				}
			}
			if(jsonMap.get("ThirdChild")!=null){
				if(!jsonMap.get("ThirdChild").equals("None")){
					map.put("ThirdChild", jsonMap.get("ThirdChild"));
				}else{
					ThirdChild = false;
				}
			}
		}
		

		
		
    }
    
    


}
